

package com.example.administrator.caigou51.recyclerCard.cardView;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.example.administrator.caigou51.EventBusClass.UpdateZhuanQuByCatID;
import com.example.administrator.caigou51.R;
import com.example.administrator.caigou51.activity.GBaseActivity;
import com.example.administrator.caigou51.recyclerCard.basic.CardItemView;
import com.example.administrator.caigou51.recyclerCard.card.UseSayDetailCard;

import de.greenrobot.event.EventBus;


public class UseSayDetailCardView extends CardItemView<UseSayDetailCard> {
 	private Context mContext;
    private TextView textViewTitle;

    public UseSayDetailCardView(Context context) {
        super(context);
        mContext=context;
        // TODO Auto-generated constructor stub
    }

    public UseSayDetailCardView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext=context;
        // TODO Auto-generated constructor stub
    }

    public UseSayDetailCardView(Context context,
                                    AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        mContext=context;
        // TODO Auto-generated constructor stub
    }
    @Override
    public void build(final UseSayDetailCard card) {
        // TODO Auto-generated method stub
        super.build(card);
        textViewTitle= (TextView) findViewById(R.id.textViewTitle);
        textViewTitle.setText(card.getSubCatEntity().getCatname());
        if (!TextUtils.isEmpty(card.getCatid()))
        {
            if (card.getSubCatEntity().getCatid().equals(card.getCatid())) {
                textViewTitle.setTextColor(((GBaseActivity) mContext).getResources().getColor(R.color.color_1ca146));
            }else
            {
                textViewTitle.setTextColor(((GBaseActivity) mContext).getResources().getColor(R.color.color_999999));
            }
        }else
        {
            textViewTitle.setTextColor(((GBaseActivity)mContext).getResources().getColor(R.color.color_999999));
        }
        setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                card.getPopupWindow().dismiss();
                card.getImageViewMore().setImageResource(R.drawable.icon_xiabiao);
                card.getTextViewSYFL().setVisibility(View.GONE);
                card.getMaterialListView().setVisibility(View.VISIBLE);
EventBus.getDefault().post(new UpdateZhuanQuByCatID(card.getSubCatEntity().getCatid(),card.getIndex()));
            }
        });
    }
}
